import request from '@/utils/request'
import { ENU_ROLE_TYPE } from '@/utils/constants'

export function getTeacherByPage(data) {
  return request({
    url: '/sys/sysuser_search',
    method: 'post',
    data: {
      ...data,
      roleId: ENU_ROLE_TYPE.TEACHER,
    },
  })
}

export function getTeacherById(id) {
  return request({
    url: '/sys/sysuser_detail',
    method: 'get',
    data: {
      id,
    },
  })
}

export function createTeacher(data) {
  return request({
    url: '/sys/sysuser_save',
    method: 'post',
    data: {
      ...data,
      password: '123456',
      roleIds: [ENU_ROLE_TYPE.TEACHER],
    },
  })
}

export function updateTeacher(data) {
  return request({
    url: '/sys/sysuser_update',
    method: 'post',
    data,
  })
}

export function deleteTeacher(id) {
  return request({
    url: '/sys/sysuser_delete',
    method: 'get',
    params: {
      id,
    },
  })
}

export function deleteTeacherByIds(ids) {
  return request({
    url: '/sys/sysuser_deletebyids',
    method: 'get',
    params: {
      ids,
    },
  })
}
